package com.ruoyi.zxjd.work.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.zxjd.work.domain.WorkTemplateTable1;
import com.ruoyi.zxjd.work.domain.bo.WorkProgressBO;
import com.ruoyi.zxjd.work.service.IWorkTemplateTable1Service;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 信息报送情况统计Controller
 * 
 * @author lcc
 * @date 2021-02-22
 */
@Controller
@RequestMapping("/work/templatetable1")
public class WorkTemplateTable1Controller extends BaseController
{
    private String prefix = "work/templatetable1";

    @Autowired
    private IWorkTemplateTable1Service workTemplateTable1Service;

    @RequiresPermissions("work:templatetable1:view")
    @GetMapping()
    public String templatetable1()
    {
        return prefix + "/templatetable1";
    }

    /**
     * 查询信息报送情况统计列表
     */
    @RequiresPermissions("work:templatetable1:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(WorkTemplateTable1 workTemplateTable1)
    {
        startPage();
        List<WorkTemplateTable1> list = workTemplateTable1Service.selectWorkTemplateTable1List(workTemplateTable1);
        return getDataTable(list);
    }

    /**
     * 导出信息报送情况统计列表
     */
    @RequiresPermissions("work:templatetable1:export")
    @Log(title = "信息报送情况统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(WorkTemplateTable1 workTemplateTable1)
    {
        List<WorkTemplateTable1> list = workTemplateTable1Service.selectWorkTemplateTable1List(workTemplateTable1);
        ExcelUtil<WorkTemplateTable1> util = new ExcelUtil<WorkTemplateTable1>(WorkTemplateTable1.class);
        return util.exportExcel(list, "templatetable1");
    }

    /**
     * 新增信息报送情况统计
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存信息报送情况统计
     */
    @RequiresPermissions("work:templatetable1:add")
    @Log(title = "信息报送情况统计", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(WorkProgressBO workProgressBO)
    {
        return toAjax(workTemplateTable1Service.insertWorkTemplateTable1(workProgressBO));
    }

    /**
     * 修改信息报送情况统计
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        WorkTemplateTable1 workTemplateTable1 = workTemplateTable1Service.selectWorkTemplateTable1ById(id);
        mmap.put("workTemplateTable1", workTemplateTable1);
        return prefix + "/edit";
    }

    /**
     * 修改保存信息报送情况统计
     */
    @RequiresPermissions("work:templatetable1:edit")
    @Log(title = "信息报送情况统计", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(WorkTemplateTable1 workTemplateTable1)
    {
        return toAjax(workTemplateTable1Service.updateWorkTemplateTable1(workTemplateTable1));
    }

    /**
     * 删除信息报送情况统计
     */
    @RequiresPermissions("work:templatetable1:remove")
    @Log(title = "信息报送情况统计", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(workTemplateTable1Service.deleteWorkTemplateTable1ByIds(ids));
    }
}
